package org.ecjmn.pringles.other;

import java.util.ArrayList;

public class Deck{
	
	public ArrayList<Card> cards;
	
	public Deck() {
		cards = new ArrayList<Card>();
		
		for (int i=0; i<52; i++) {
			cards.add(new Card());
		}
		
		for (int i=0; i<4; i++) {
			for (int j=0; j<13; j++) {
				cards.get(i*13 + j).flower = i;
				cards.get(i*13 + j).value = j;
			}
		}
	}
	
	public void shuffle() {
		
		for (int i=0; i<52; i++) {
			// Pick 2 cards
			Card card1 = cards.get((int) Math.random()*52);
			Card card2 = cards.get((int) Math.random()*52);
			
			int flowerOfCard1 = card1.flower;
			int valueOfCard1 = card1.value;
			
			// Swap
			card1.flower = card2.flower;
			card1.value = card2.value;
			// Swap
			card2.flower = flowerOfCard1;
			card2.value = valueOfCard1;
		}
	}
	
	// Pop a card from the deck
	public Card pop() {
		return cards.remove(0);
	}
	
	// 
}
